﻿using System;

namespace Red.Toolkit.PhysicalDecorationEditor
{
    public class InteropStructureStringBuilder
    {
        private String _output;

        public InteropStructureStringBuilder() 
        {
            _output = "";
        }

        public void BeginStructure()
        {
            _output += "{";
        }

        public void EndStructure()
        {
            _output += "}";
        }

        public void BeginArray()
        {
            _output += "[";
        }

        public void EndArray()
        {
            _output += "]";
        }

        public void AddProperty(String name, String value, bool needQuotes = false)
        {
            _output += "" + name + "=";
            _output += needQuotes ? "\"" : "";
            _output += value;
            _output += needQuotes ? "\"" : "";
        }

        public void AddSeparator()
        {
            _output += ",";
        }

        public string Build()
        {
            String ret = _output;
            _output = "";
            return ret;
        }
    }
}
